<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>新增权限</title> 
  <link rel="stylesheet" href="../../assets/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="../../assets/css/global.css" media="all">
  <link rel="stylesheet" href="../../assets/js/font-awesome/css/font-awesome.min.css">
 </head> 
 <body> 
  <div class="admin-main">  
   <form class="layui-form" action="/api/resource/add">  
       <div class="layui-form-item">
        <label class="layui-form-label">权限类型</label>
         <div class="layui-input-block">
         <input type="radio" name="type" value="uri" title="接口" checked="" lay-filter="type">
         <!-- <input type="radio" name="type" value="button" title="前端按钮" lay-filter="type"> -->
        </div>
       </div>
       <div class="layui-form-item"> 
        <label class="layui-form-label">所属模块</label> 
        <div class="layui-input-block"> 
         <select id="moduleId" name="moduleId" lay-verify="required" asnycSelect="/api/module/options" lay-filter="module_select">
           <option value="">请选择模块</option> 
         </select> 
        </div> 
       </div>
       
       <div class="layui-form-item">
        <label class="layui-form-label">选择接口</label>
        <div class="layui-input-inline">
         <select id="name_select" lay-filter="name_select">
            <option value="">请选择接口</option>
         </select> 
       </div>
       <div class="layui-form-mid layui-word-aux">选择接口或者手动输入接口信息</div>
      </div> 
       <div class="layui-form-item"> 
        <label id="code_label" class="layui-form-label">接口名称</label> 
        <div class="layui-input-block"> 
         <input type="text" id="nameinput" class="layui-input" bindattr="name" name="name" lay-verify="required" placeholder="请输入权限名称" /> 
        </div>
       </div> 
       <div class="layui-form-item"> 
        <label id="code_label" class="layui-form-label">接口链接</label> 
        <div class="layui-input-block"> 
         <input type="text" id="resourceinput" class="layui-input" bindattr="resource" name="resource" lay-verify="required" placeholder="请输入接口链接,可以使用通配符,如:/user/*" /> 
        </div> 
       </div> 
		     
    <div class="layui-form-item"> 
     <div class="layui-input-block"> 
        <input type="button"  class="layui-btn layui-btn-normal J_ajaxSubmit" value="保存并返回"/>
        <input type="button"  class="layui-btn layui-btn-normal J_ajaxSubmit" onSuccessCallback="None" value="保存并继续添加"/>
        <input type="reset" class="layui-btn layui-btn-primary" value="重置"/>
     </div> 
    </div> 
   </form> 
  </div> 
 </body>
 <script type="text/javascript" src="../../assets/js/layui/layui.js"></script>
<script>
	layui.config({
		version : "1.0.0",
		base : '../../assets/js/modules/'
	}).use('resource',function(){
		layui.form.on('radio(type)', function(data){
			var $ = layui.jquery;
			 if(data.value === 'uri'){
				 $('#code_label').html('接口链接');
			 }else{
				 $('#code_label').html('权限编码');
			 }
		});
	});
</script>
</html>